using System;
using System.Data;

using Wicresoft.Common;
 
namespace Wicresoft.Messages.Entity
{
	[Table("ProcessPercent", "", "Wicresoft.Messages.ConnectionString")]
	public class ProcessPercent : Info
	{
		#region SQL column name consts 
		public const string SQLCOL_PROCESSID = "ProcessID";
		public const string SQLCOL_BATCHID = "BatchID";
		public const string SQLCOL_PERCENT = "Percent";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public ProcessPercent () {}

		/// <summary>
		/// Construct entity by primary key, other fields will be assigned by 
		/// "Load" method.
		/// </summary>
		public ProcessPercent (Guid ProcessID)
		{
			this.ProcessID = ProcessID;
		}
		#endregion

		public override void Init (DataRow row)
		{
			ProcessID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_PROCESSID]);
			BatchID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_BATCHID]);
			Percent = (short)ObjectType.ShortTypeHelper.Read(row[SQLCOL_PERCENT]);
		}

		#region Properties 
		#region Property <Guid> ProcessID
		[Property("ProcessID", 16, SqlDbType.UniqueIdentifier, false, true)]
		public Guid ProcessID 
		{
			get { return _ProcessID; }
			set { _ProcessID = value; }
		}
		private Guid _ProcessID = Guid.Empty;
		#endregion

		#region Property <Guid> BatchID
		[Property("BatchID", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid BatchID 
		{
			get { return _BatchID; }
			set { _BatchID = value; }
		}
		private Guid _BatchID = Guid.Empty;
		#endregion

		#region Property <short> Percent
		[Property("Percent", 2, SqlDbType.SmallInt, false, false)]
		public short Percent 
		{
			get { return _Percent; }
			set { _Percent = value; }
		}
		private short _Percent = short.MinValue;
		#endregion
		#endregion




	}
}
